package net.child.chess.pieces;

import net.child.chess.utils.ChessDef;

//This class holds the needed information for a move. 
public class MoveInfo 
{
	//	The constructor should be called before the move in order to save the
	//	correct info.
	public MoveInfo(Piece piece, int to)
	{
		mPiece = piece;
		mPieceState = new PieceState(piece.state());
		mToPosition = to;
	}
	
	public boolean isSameMove(Piece.Type type, ChessDef.Color color, int from, int to)
	{
		return ((mPiece.type() == type) && (mPiece.color() == color) && 
			    (mPieceState.position().position() == from) && (mToPosition == to));  
	}
	
	public int from()
	{
		return mPieceState.position().position();
	}
	
	public int to()
	{
		return mToPosition;
	}
	
	public Piece piece()
	{
		return mPiece;
	}
	
	public PieceState state()
	{
		return mPieceState;
	}
	
	private Piece mPiece;
	private PieceState mPieceState;
	private int mToPosition;
}
